package nl.vu.few.ibivu.biomodels.client.ui.base;


import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceController;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Cursor;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;

public class Link extends Label {
	Place place;
	String url;
	PlaceController placeController;
	
	public Link(PlaceController placeController, Place place) {
		super();
		this.setAutoHeight();
		this.setAutoWidth();
		this.setAlign(Alignment.CENTER);  
		this.setValign(VerticalAlignment.CENTER); 
		this.setCursor(Cursor.POINTER);
		this.setWrap(false);
		this.place = place;
		this.url = null;
		this.placeController = placeController;
		this.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				Link.this.placeController.goTo(Link.this.place);
			}
		});
	}
	
	

	public Link(PlaceController placeController, Place place, String contents) {
		this(placeController, place);
		this.setContents(contents);
	}

}
